from typing import *

class Solution:
    def exchange(self, nums: List[int]) -> List[int]:
        a = [[],[]]
        for num in nums:
            a[num % 2].append(num)

        ans = []
        for v in a[1]:
            ans.append(v)
        for v in a[0]:
            ans.append(v)
        return ans